<script setup lang="ts">
import { ref } from 'vue';
import { getAllTree } from '#/api';
import CustomerTree from '#/components/Tree/CustomerTree.vue';
import type { TreeType } from '#/components/Tree/types';

const selectedValue = ref<TreeType>('热源');
const nodeId = ref<string | string[]>('');

// 处理数据加载
const handleLoadData = async (type: number, id: string) => {
  const res = await getAllTree(type, id);
  return res;
};
</script>

<template>
  <CustomerTree
    v-model:selectedValue="selectedValue"
    v-model:nodeId="nodeId"
    :defaultType="selectedValue"
    :loadData="handleLoadData"
    :treeList="['热源', '热站', '小区', '热用户']"
  />
</template>
